package com.IODemo.ByteStream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Author milian
 * @Date 2021/7/27 0027 18:34
 */
public class demo1 {
    public static void main(String[] args) throws IOException{
        FileOutputStream fileOutputStream = new FileOutputStream("H:\\test\\test.txt");
        fileOutputStream.write(43);
        fileOutputStream.close();
//        通过数组进行输出
        byte[] bt ="wdnm".getBytes();
        FileOutputStream fos = null;
        try {
           fos = new FileOutputStream("H:\\test\\test.txt");
            fos.write(bt,0,  bt.length);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fos!=null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }



//        FileInputStream fis = new FileInputStream("H:\\test\\test.txt");
//        fis.read();
    }
}
